package Code.StringTraverse;

import java.util.Scanner;

//遍历字符串
public class demo {
    public static void main(String[] args) {
        //键盘录入
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String str = scanner.next();

        //遍历
        for (int i = 0; i < str.length(); i++) {
            //charAt获取字符串索引的值
            System.out.print(str.charAt(i) + " ");
        }
    }

}
